package web;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import dao.ProdDao;

import entity.Prod;

public class EditServlet extends HttpServlet {

	private static final long serialVersionUID = 1L;

	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		request.setCharacterEncoding("UTF-8");

		String id = request.getParameter("id");
		String prodName = request.getParameter("prodname");
		String price = request.getParameter("price");
		
		Prod prod = new Prod();
		prod.setId(Integer.valueOf(id));
		prod.setPrice(Float.valueOf(price));
		prod.setProdname(prodName);
		
		new ProdDao().update(prod);
		
		response.sendRedirect("home.jsp");
		
	}
	
	
	

}
